#pragma once
#include <Windows.h>

namespace windows {
namespace user {
class Device {
 public:
  Device();
  ~Device();
  DWORD Open(_In_ LPCTSTR file_name, _In_ BOOL asynchronous = FALSE);

  VOID Close();

  DWORD Read(_In_ PVOID buf, _Inout_ DWORD &size);
  DWORD ReadAsync(_In_ PVOID buf, _Inout_ DWORD &size,
                  _In_ OVERLAPPED &overlapped);

  DWORD Write(_Out_ PVOID buf, _Inout_ DWORD &size);

  DWORD Control(_In_ DWORD control_code, _In_ PVOID input_buffer,
               _In_ ULONG input_buffer_size, _Out_ PVOID output_buffer,
               _In_ ULONG output_buffer_size,
               _Out_opt_ PDWORD returned_bytes = nullptr);

  bool CancelIo();
 
 private:
  DWORD FormatSymbolicLink(_In_ LPCTSTR file_name,
                           _In_ LPTSTR standard_symbolic_link,
                           _Inout_ SIZE_T &size);

 private:
  TCHAR file_name_[0x100];
  HANDLE device_handle_;
}; 
}
}




